/**
 * @date 2006-5-15 16:20:40
 *
 */
package org.nanhill.moo.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * @author alin [xalinx at gmail dot com]
 * 
 */
public class UserGroup {
	private long id;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Group name.
	 */
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Group intro.
	 */
	private String intro;

	public String getIntro() {
		return intro;
	}

	public void setIntro(String remark) {
		this.intro = remark;
	}

	/**
	 * Group users.
	 */
	private Set<User> users;

	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	/**
	 * Group logo path.
	 */
	private String logoPath;

	public String getLogoPath() {
		return logoPath;
	}

	public void setLogoPath(String logoPath) {
		this.logoPath = logoPath;
	}

	/**
	 * Group Creation date.
	 */
	private Date createTime;

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * Creator of this user group.
	 */
	private User creator;

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	/**
	 * Add user.
	 * 
	 * @param user
	 * @see org.nanhill.moo.domain.User#joinGroup(UserGroup)
	 */
	void addUser(User user) {
		if (null == users) {
			users = new HashSet<User>();
		}
		users.add(user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	// @Override
	// public boolean equals(Object other) {
	// if (null == other)
	// return false;
	// if (other == this || other instanceof UserGroup)
	// return true;
	// final UserGroup group = (UserGroup) other;
	// return null == name ? null == group.getName() : name.equals(group
	// .getName());
	// }
}
